﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ChineseSchool.BLL;
using ChineseSchool.Models.Hethong;

namespace ChineseSchool.UserControl.ThuNghiem
{
    public partial class CacKhoaHoc : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            lblLessons.Text = LoadLessons();
        }

        public string LoadLessons()
        {
            var strUsers = "";
            var lstTopLessons = new B_Lessons().GetTop3Lesson();
            if (lstTopLessons != null && lstTopLessons.Count > 0)
            {
                foreach (M_Lessons lessons in lstTopLessons)
                {
                    strUsers += "<section class=\"featured-world-news\">";
                    strUsers += "    <div class=\"featured-world-news-img\">";
                    strUsers += "        <img src=\"" + lessons.ImageUrl + "\" alt=\"" + lessons.LessonTitle + "\">";
                    strUsers += "    </div>";
                    strUsers += "    <div class=\"featured-world-news-post\">";
                    strUsers += "        <h5>" + lessons.LessonTitle + "</h5>";
                    strUsers += "        " + lessons.LessonTitle + "";
                    strUsers += "                        <div class=\"like-comment-readmore\">";
                    strUsers += "                            <i class=\"fa fa-thumbs-o-up\">08</i>";
                    strUsers += "                            <a href=\"#\" class=\"comments\"><i class=\"fa fa-comments-o\"></i>49</a>";
                    strUsers += "                            <a class=\"read-more\" href=\"" + Util.MakeLinkLessonDetail(lessons.LessonID.ToString(CultureInfo.InvariantCulture), Encode.Uni2KD(lessons.LessonTitle)) + "\">Chi tiết</a>";
                    strUsers += "                        </div>";
                    strUsers += "    </div>";
                    strUsers += "</section>";
                }


            }
            return strUsers;
        }
    }
}